//6.设计函数实现冒泡排序
#include<stdio.h>
void maopao(int a[],int n)
{
	int t;
	for(int i = 0; i < n - 1; i++)
	{
		if(a[i] > a[i+1])
		{
			t = a[i+1];
			a[i+1] = a[i];
			a[i] = t;
		}
	}
	if(n > 1)
		maopao(a,n-1);
}
void print(int a[],int n)
{
	printf("排序后数组：");
	for(int i = 0; i < n ;i++)
	{	
		printf("%4d",a[i]);
	}
	printf("\n");
}
int main()
{
	int a[] = {12,89,56,35,21,74,52,63,54,62};
	int n = sizeof a / sizeof a[0];
	maopao(a,n);
	print(a,n);
	return 0;
}
